package com.dlc.beijingrfid.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.dlc.beijingrfid.R;
import com.dlc.beijingrfid.net.bean.DistributeOrderBean;
import com.holenzhou.pullrecyclerview.BaseRecyclerAdapter;
import com.holenzhou.pullrecyclerview.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2017/7/19 0019.
 */

public class OddAdapter extends BaseRecyclerAdapter<DistributeOrderBean.DataBean.ListBean> {
    private Context context;
    private LayoutInflater inflater;
    private OnItemClickListener onItemClickListener;

    public OddAdapter(Context context, int layoutResId, List<DistributeOrderBean.DataBean.ListBean> data) {
        super(context, layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, final DistributeOrderBean.DataBean.ListBean item, final int position) {
        holder.setText(R.id.orderno,item.orderno);
        holder.setText(R.id.order_time,item.ctime);
        holder.setOnClickListener(R.id.odd_item, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onItemClickListener.onClick(position,item.id);
            }
        });


    }

   /* public OddAdapter(Context context) {
        this.context = context;
        this.inflater=LayoutInflater.from(context);
    }

    @Override
    public OddViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new OddViewHolder(inflater.inflate(R.layout.item_odd,parent,false));
    }

    @Override
    public void onBindViewHolder(OddViewHolder holder, int position) {
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context, DistributeOddDetailActivity.class));
            }
        });

    }

    @Override
    public int getItemCount() {
        return 8;
    }*/

    /*class OddViewHolder extends RecyclerView.ViewHolder {
        public OddViewHolder(View itemView) {
            super(itemView);
        }
    }*/
    public  interface OnItemClickListener{
        void onClick(int position,String id);


    }
    public void setOnItemClickListener(OnItemClickListener onItemClickListener){
        this.onItemClickListener=onItemClickListener;
    }

}
